<template>
  <div>
    <div class="common-layout">
      <div class="aside">
        <div class="user">
          <el-avatar
            :size="100"
            :src="store.userinfo.avatar"
          />
          <div class="mt-10">用户名:{{store.userinfo.name}}</div>
        </div>
        <div @click.native="tapHandler($event)">
          <router-link class="resource mb-10" to="/home/center/dynamics"
            :class="(route.path=='/home/center/dynamics')? 'sideber' : ''"
            >资源动态</router-link
          >
          <router-link class="resource" to="/home/center/my_member"
          :class="(route.path=='/home/center/my_member')? 'sideber' : ''"
            >我的会员</router-link
          >
          <router-link class="resource" to="/home/center/wallet"
          :class="(route.path=='/home/center/wallet')? 'sideber' : ''"
            >我的钱包</router-link
          >
          <router-link class="resource" to="/home/center/coupons"
          :class="(route.path=='/home/center/coupons')? 'sideber' : ''"
            >我的优惠券</router-link
          >
          <router-link class="resource" to="/home/center/buyer"
          :class="(route.path=='/home/center/buyer')? 'sideber' : ''"
            >我买的订单</router-link
          >
          <router-link class="resource" to="/home/center/seller"
          :class="(route.path=='/home/center/seller')? 'sideber' : ''"
          >我卖的</router-link
          >
          <router-link class="resource mt-10" to="/home/center/edit_info"
          :class="(route.path=='/home/center/edit_info')? 'sideber' : ''"
            >我的资料</router-link
          >
        </div>
      </div>
      <div class="right">
        <el-card shadow="hover">
          <div>{{ HeaderText }}</div>
        </el-card>
        <div class="right-main"><router-view></router-view></div>

      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import {useUserInfoStore} from '@/stores/userInfo';
import { ref } from "vue";
import { useRoute } from "vue-router";

const route = useRoute();
const store = useUserInfoStore();
const HeaderText = ref("资源动态");
const tapHandler = (e: { target: any }) => {
  HeaderText.value = e.target.innerHTML;
};
</script>

<style scoped>
.user {
  height: 200px;
  line-height: 1.15;
  -webkit-box-direction: normal;
  padding: 20px 0;
  text-align: center;
  background: #fff;
  border-radius: 4px;
  margin-bottom: 10px;
}

.resource {
  line-height: 1.15;
  -webkit-box-direction: normal;
  background-color: transparent;
  color: #111;
  background: #fff;
  padding: 17px 21px;
  cursor: pointer;
  position: relative;
  display: block;
  text-decoration: none;
  border-radius: 4px;
}

.mt-10 {
  margin-top: 10px;
}

.mb-10 {
  margin-bottom: 10px;
}

.sideber {
  border-left: solid 4px #f93684;
}
a:hover {
  border-left: solid 4px #f93684;
}


.common-layout {
  display: flex;
  text-align: center;
  width: 1200px;
  padding: 20px;
  margin: 0 auto;
}

.aside {
  width: 170px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
}

.right {
  width: 1020px;
  display: flex;
  flex-direction: column;
  margin-left: 10px;
}

.right-header {
  -webkit-box-direction: normal;
  border-radius: 4px;
  background-color: #fff;
  position: relative;
  margin-bottom: 10px;
  height: 70px;
  line-height: 70px;
}

.right-main {
  /* height: 650px; */
  width: 990px;
  line-height: 1.15;
  -webkit-box-direction: normal;
  background: #fff;
  border-radius: 4px;
  margin-top: 10px;
  padding:30px 30px 30px 0px;
}
</style>
